package com.example.demo01.mapper;

import com.example.demo01.entity.Infor;
import com.example.demo01.entity.Middle;
import com.example.demo01.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

public interface InforMapper {
    @Select("select id,names,password,email,createtime from infor where createtime between #{starttime}and #{endtime};")
    public List<Infor> getAll(String starttime,String endtime);
    @Select("select * from infor where names like '%${names}%';")
    public List<Infor> getname(String names);
    @Insert("insert into infor(id,names,password,email,createtime)values(#{id},#{names},#{password},#{email},#{createtime});")
    public int insertInfor(Infor infor);
    @Select("select infor.names,infor.email,role.rolename,infor.createtime from infor left join prole pr on pr.id=infor.id LEFT JOIN role ON role.id=pr.id")
    public List<Middle> getname2(String names, String email, String rolename, Date createtime);
    @Update("update infor set names=#{names},password=#{password},email=#{email} where id=#{id}")
    public int updates(int id,String names,String password,String email);
    @Delete(" delete from infor where id=#{id};")
    public int delete(int id);

}
